﻿// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证（版本 2.0）进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动！任何基于本项目二次开发而产生的一切法律纠纷和责任，我们不承担任何责任！

using Admin.NET.Core;
using Sinc.ERP.Core.Enum;
using System.ComponentModel.DataAnnotations;

namespace Sinc.ERP.Application;

/// <summary>
/// 序列基础输入参数
/// </summary>
public class SequenceBaseInput
{
    /// <summary>
    /// 主键Id
    /// </summary>
    public virtual long? Id { get; set; }
    
    /// <summary>
    /// 序列代码
    /// </summary>
    [Required(ErrorMessage = "序列代码不能为空")]
    public virtual string Code { get; set; }
    
    /// <summary>
    /// 序列名称
    /// </summary>
    [Required(ErrorMessage = "序列名称不能为空")]
    public virtual string Name { get; set; }
    
    /// <summary>
    /// 当前值
    /// </summary>
    [Required(ErrorMessage = "当前值不能为空")]
    public virtual long? CurrentValue { get; set; }
    
    /// <summary>
    /// 最小值
    /// </summary>
    [Required(ErrorMessage = "最小值不能为空")]
    public virtual long? MinValue { get; set; }
    
    /// <summary>
    /// 最大值
    /// </summary>
    [Required(ErrorMessage = "最大值不能为空")]
    public virtual long? MaxValue { get; set; }
    
    /// <summary>
    /// 步长
    /// </summary>
    [Required(ErrorMessage = "步长不能为空")]
    public virtual long? Increment { get; set; }
    
    /// <summary>
    /// 循环模式
    /// </summary>
    [Dict(nameof(SequenceCycleTypeEnum), AllowNullValue=true)]
    [Required(ErrorMessage = "循环模式不能为空")]
    public virtual SequenceCycleTypeEnum? Cycle { get; set; }
    
    /// <summary>
    /// 缓存数量
    /// </summary>
    [Required(ErrorMessage = "缓存数量不能为空")]
    public virtual long? Cache { get; set; }
    
    /// <summary>
    /// 备注
    /// </summary>
    public virtual string? Remark { get; set; }
    
}

/// <summary>
/// 序列分页查询输入参数
/// </summary>
public class PageSequenceInput : BasePageInput
{
    /// <summary>
    /// 序列代码
    /// </summary>
    public string Code { get; set; }
    
    /// <summary>
    /// 序列名称
    /// </summary>
    public string Name { get; set; }
    
    /// <summary>
    /// 当前值
    /// </summary>
    public long? CurrentValue { get; set; }
    
    /// <summary>
    /// 最小值
    /// </summary>
    public long? MinValue { get; set; }
    
    /// <summary>
    /// 最大值
    /// </summary>
    public long? MaxValue { get; set; }
    
    /// <summary>
    /// 步长
    /// </summary>
    public long? Increment { get; set; }
    
    /// <summary>
    /// 循环模式
    /// </summary>
    [Dict(nameof(SequenceCycleTypeEnum), AllowNullValue=true)]
    public SequenceCycleTypeEnum? Cycle { get; set; }
    
    /// <summary>
    /// 缓存数量
    /// </summary>
    public long? Cache { get; set; }
    
    /// <summary>
    /// 备注
    /// </summary>
    public string? Remark { get; set; }
    
    /// <summary>
    /// 选中主键列表
    /// </summary>
     public List<long> SelectKeyList { get; set; }
}

/// <summary>
/// 序列增加输入参数
/// </summary>
public class AddSequenceInput
{
    /// <summary>
    /// 序列代码
    /// </summary>
    [Required(ErrorMessage = "序列代码不能为空")]
    [MaxLength(100, ErrorMessage = "序列代码字符长度不能超过100")]
    public string Code { get; set; }
    
    /// <summary>
    /// 序列名称
    /// </summary>
    [Required(ErrorMessage = "序列名称不能为空")]
    [MaxLength(100, ErrorMessage = "序列名称字符长度不能超过100")]
    public string Name { get; set; }
    
    /// <summary>
    /// 当前值
    /// </summary>
    [Required(ErrorMessage = "当前值不能为空")]
    public long? CurrentValue { get; set; }
    
    /// <summary>
    /// 最小值
    /// </summary>
    [Required(ErrorMessage = "最小值不能为空")]
    public long? MinValue { get; set; }
    
    /// <summary>
    /// 最大值
    /// </summary>
    [Required(ErrorMessage = "最大值不能为空")]
    public long? MaxValue { get; set; }
    
    /// <summary>
    /// 步长
    /// </summary>
    [Required(ErrorMessage = "步长不能为空")]
    public long? Increment { get; set; }
    
    /// <summary>
    /// 循环模式
    /// </summary>
    [Dict(nameof(SequenceCycleTypeEnum), AllowNullValue=true)]
    [Required(ErrorMessage = "循环模式不能为空")]
    public SequenceCycleTypeEnum? Cycle { get; set; }
    
    /// <summary>
    /// 缓存数量
    /// </summary>
    [Required(ErrorMessage = "缓存数量不能为空")]
    public long? Cache { get; set; }
    
    /// <summary>
    /// 备注
    /// </summary>
    [MaxLength(1000, ErrorMessage = "备注字符长度不能超过1000")]
    public string? Remark { get; set; }
    
}

/// <summary>
/// 序列删除输入参数
/// </summary>
public class DeleteSequenceInput
{
    /// <summary>
    /// 主键Id
    /// </summary>
    [Required(ErrorMessage = "主键Id不能为空")]
    public long? Id { get; set; }
    
}

/// <summary>
/// 序列更新输入参数
/// </summary>
public class UpdateSequenceInput
{
    /// <summary>
    /// 主键Id
    /// </summary>    
    [Required(ErrorMessage = "主键Id不能为空")]
    public long? Id { get; set; }
    
    /// <summary>
    /// 序列代码
    /// </summary>    
    [Required(ErrorMessage = "序列代码不能为空")]
    [MaxLength(100, ErrorMessage = "序列代码字符长度不能超过100")]
    public string Code { get; set; }
    
    /// <summary>
    /// 序列名称
    /// </summary>    
    [Required(ErrorMessage = "序列名称不能为空")]
    [MaxLength(100, ErrorMessage = "序列名称字符长度不能超过100")]
    public string Name { get; set; }
    
    /// <summary>
    /// 当前值
    /// </summary>    
    [Required(ErrorMessage = "当前值不能为空")]
    public long? CurrentValue { get; set; }
    
    /// <summary>
    /// 最小值
    /// </summary>    
    [Required(ErrorMessage = "最小值不能为空")]
    public long? MinValue { get; set; }
    
    /// <summary>
    /// 最大值
    /// </summary>    
    [Required(ErrorMessage = "最大值不能为空")]
    public long? MaxValue { get; set; }
    
    /// <summary>
    /// 步长
    /// </summary>    
    [Required(ErrorMessage = "步长不能为空")]
    public long? Increment { get; set; }
    
    /// <summary>
    /// 循环模式
    /// </summary>    
    [Dict(nameof(SequenceCycleTypeEnum), AllowNullValue=true)]
    [Required(ErrorMessage = "循环模式不能为空")]
    public SequenceCycleTypeEnum? Cycle { get; set; }
    
    /// <summary>
    /// 缓存数量
    /// </summary>    
    [Required(ErrorMessage = "缓存数量不能为空")]
    public long? Cache { get; set; }
    
    /// <summary>
    /// 备注
    /// </summary>    
    [MaxLength(1000, ErrorMessage = "备注字符长度不能超过1000")]
    public string? Remark { get; set; }
    
}

/// <summary>
/// 序列主键查询输入参数
/// </summary>
public class QueryByIdSequenceInput : DeleteSequenceInput
{
}

/// <summary>
/// 序列数据导入实体
/// </summary>
[ExcelImporter(SheetIndex = 1, IsOnlyErrorRows = true)]
public class ImportSequenceInput : BaseImportInput
{
    /// <summary>
    /// 序列代码
    /// </summary>
    [ImporterHeader(Name = "*序列代码")]
    [ExporterHeader("*序列代码", Format = "", Width = 25, IsBold = true)]
    public string Code { get; set; }
    
    /// <summary>
    /// 序列名称
    /// </summary>
    [ImporterHeader(Name = "*序列名称")]
    [ExporterHeader("*序列名称", Format = "", Width = 25, IsBold = true)]
    public string Name { get; set; }
    
    /// <summary>
    /// 当前值
    /// </summary>
    [ImporterHeader(Name = "*当前值")]
    [ExporterHeader("*当前值", Format = "", Width = 25, IsBold = true)]
    public long? CurrentValue { get; set; }
    
    /// <summary>
    /// 最小值
    /// </summary>
    [ImporterHeader(Name = "*最小值")]
    [ExporterHeader("*最小值", Format = "", Width = 25, IsBold = true)]
    public long? MinValue { get; set; }
    
    /// <summary>
    /// 最大值
    /// </summary>
    [ImporterHeader(Name = "*最大值")]
    [ExporterHeader("*最大值", Format = "", Width = 25, IsBold = true)]
    public long? MaxValue { get; set; }
    
    /// <summary>
    /// 步长
    /// </summary>
    [ImporterHeader(Name = "*步长")]
    [ExporterHeader("*步长", Format = "", Width = 25, IsBold = true)]
    public long? Increment { get; set; }
    
    /// <summary>
    /// 循环模式
    /// </summary>
    [ImporterHeader(Name = "*循环模式")]
    [ExporterHeader("*循环模式", Format = "", Width = 25, IsBold = true)]
    public SequenceCycleTypeEnum? Cycle { get; set; }
    
    /// <summary>
    /// 缓存数量
    /// </summary>
    [ImporterHeader(Name = "*缓存数量")]
    [ExporterHeader("*缓存数量", Format = "", Width = 25, IsBold = true)]
    public long? Cache { get; set; }
    
    /// <summary>
    /// 备注
    /// </summary>
    [ImporterHeader(Name = "备注")]
    [ExporterHeader("备注", Format = "", Width = 25, IsBold = true)]
    public string? Remark { get; set; }
    
}
